In a payment system, bookkeeping operations, such as balance changes for the same account, comply with a principle of serial processing. Specifically, no matter how many concurrent bookkeeping operation requests there are, only one bookkeeping operation can be performed at one time for the same account. In a process of a bookkeeping operation, an exclusive lock is needed to lock the account, and each account can only use one exclusive lock. Such a serial processing method can avoid economic losses due to an erroneous result caused by simultaneously performing multiple bookkeeping operations on the account.
Although the aforementioned serial processing method can avoid the risk of economic losses caused by concurrent operations, the efficiency of the bookkeeping operations cannot be improved. Under this method, when an application system needs to perform multiple bookkeeping operations on a certain account, only one of application threads that handle each bookkeeping operation can acquire an exclusive lock of the account, and application threads that handle other bookkeeping operations can only perform respective bookkeeping operations after the exclusive lock is released. In this process, an application thread that fails to acquire the exclusive lock needs to suspend an application resource for performing a respective bookkeeping operation, and waits in a queue to acquire the exclusive lock. Since the resource of the application thread cannot be released, a collapse of the application system is very likely to occur when a relatively large number of concurrent bookkeeping operation requests for the account exist.
In short, the existing serial processing methods have a low efficiency of performing bookkeeping operations on an account. An application system performing the bookkeeping operations may be prone to crashes when a large number of concurrent bookkeeping operation requests exist, thereby causing a failure in transaction processing.